let price_min,price_max

(function (a) {
    var o = a(".sticky-bar");
    var w = a(window);
    w.on("scroll", function () {
        var x = w.scrollTop();
        if (x < 200) {
            o.removeClass("stick")
        } else {
            o.addClass("stick")
        }
    });
    if (a(".cart-wrap").length) {
        var b = a("body"),
            e = a(".cart-wrap"),
            d = e.find(".shopping-cart-content");
        e.on("click", ".icon-cart-active", function (y) {
            y.preventDefault();
            var x = a(this);
            if (!x.parent().hasClass("show")) {
                x.siblings(".shopping-cart-content").addClass("show").parent().addClass("show")
            } else {
                x.siblings(".shopping-cart-content").removeClass("show").parent().removeClass("show")
            }
        });
        e.on("click", ".cart-close", function (y) {
            y.preventDefault();
            var x = a(this);
            x.closest(".cart-wrap").removeClass("show").find(".shopping-cart-content").removeClass("show")
        });
        b.on("click", function (y) {
            var x = y.target;
            if (!a(x).is(".cart-wrap") && !a(x).parents().is(".cart-wrap") && e.hasClass("show")) {
                e.removeClass("show");
                d.removeClass("show")
            }
        })
    }
    if (a(".setting-wrap").length) {
        var c = a("body"),
            h = a(".setting-wrap"),
            i = h.find(".setting-content");
        h.on("click", ".setting-active", function (y) {
            y.preventDefault();
            var x = a(this);
            if (!x.parent().hasClass("show")) {
                x.siblings(".setting-content").addClass("show").slideDown().parent().addClass("show")
            } else {
                x.siblings(".setting-content").removeClass("show").slideUp().parent().removeClass("show")
            }
        });
        c.on("click", function (y) {
            var x = y.target;
            if (!a(x).is(".setting-wrap") && !a(x).parents().is(".setting-wrap") && h.hasClass("show")) {
                h.removeClass("show");
                i.removeClass("show").slideUp()
            }
        })
    }
    a(".slider-active").owlCarousel({
        loop: true,
        nav: true,
        autoplay: false,
        navText: ['<i class="sli sli-arrow-left"></i>', '<i class="sli sli-arrow-right"></i>'],
        autoplayTimeout: 5000,
        animateOut: "fadeOut",
        animateIn: "fadeIn",
        item: 1,
        responsive: {
            0: {
                items: 1
            },
            768: {
                items: 1
            },
            1000: {
                items: 1
            }
        }
    });
    a(".slider-active-2").owlCarousel({
        loop: true,
        nav: true,
        autoplay: false,
        navText: ['<i class="sli sli-arrow-up"></i>', '<i class="sli sli-arrow-down"></i>'],
        autoplayTimeout: 5000,
        animateOut: "fadeOut",
        animateIn: "fadeIn",
        item: 1,
        responsive: {
            0: {
                items: 1
            },
            768: {
                items: 1
            },
            1000: {
                items: 1
            }
        }
    });
    a(".slider-active-3").owlCarousel({
        loop: true,
        nav: true,
        autoplay: false,
        navText: ['<i class="sli sli-arrow-up"></i><span>Prev</span>', '<i class="sli sli-arrow-down"></i><span>Next</span>'],
        autoplayTimeout: 5000,
        animateOut: "fadeOut",
        animateIn: "fadeIn",
        item: 1,
        responsive: {
            0: {
                items: 1
            },
            768: {
                items: 1
            },
            1000: {
                items: 1
            }
        }
    });
    a(".product-slider-active").owlCarousel({
        loop: true,
        nav: false,
        autoplay: false,
        autoplayTimeout: 5000,
        animateOut: "fadeOut",
        animateIn: "fadeIn",
        item: 4,
        margin: 30,
        responsive: {
            0: {
                items: 1
            },
            576: {
                items: 2
            },
            768: {
                items: 2
            },
            992: {
                items: 3
            },
            1200: {
                items: 4
            }
        }
    });
    a(".product-slider-active-2").owlCarousel({
        loop: true,
        nav: false,
        autoplay: false,
        autoplayTimeout: 5000,
        animateOut: "fadeOut",
        animateIn: "fadeIn",
        item: 3,
        margin: 30,
        responsive: {
            0: {
                items: 1
            },
            576: {
                items: 2
            },
            768: {
                items: 2
            },
            992: {
                items: 3
            },
            1200: {
                items: 3
            }
        }
    });

    function s() {
        var z = a("a.search-active"),
            y = a("button.search-close"),
            x = a(".main-search-active");
        z.on("click", function (A) {
            A.preventDefault();
            x.addClass("inside")
        });
        y.on("click", function () {
            x.removeClass("inside")
        })
    }
    s();
    a(".testimonial-active").owlCarousel({
        loop: true,
        nav: false,
        autoplay: true,
        autoplayTimeout: 5000,
        item: 1,
        margin: 30,
        responsive: {
            0: {
                items: 1,
                autoplay: true,
            },
            576: {
                items: 1
            },
            768: {
                items: 1
            },
            1000: {
                items: 1
            }
        }
    });
    a(".quickview-slide-active").owlCarousel({
        loop: true,
        navText: ["<i class='sli sli-arrow-left'></i>", "<i class='sli sli-arrow-right'></i>"],
        margin: 15,
        smartSpeed: 1000,
        nav: true,
        dots: false,
        responsive: {
            0: {
                items: 3,
                autoplay: true,
                smartSpeed: 300
            },
            576: {
                items: 3
            },
            768: {
                items: 3
            },
            1000: {
                items: 3
            }
        }
    });
    a(".quickview-slide-active a").on("click", function () {
        a(".quickview-slide-active a").removeClass("active")
    });
    var m = a(".cart-plus-minus");
    m.prepend('<div class="dec qtybutton">-</div>');
    m.append('<div class="inc qtybutton">+</div>');
    a(".qtybutton").on("click", function () {
        var x = a(this);
        var z = x.parent().find("input").val();
        if (x.text() === "+") {
            var y = parseFloat(z) + 1
        } else {
            if (z > 0) {
                var y = parseFloat(z) - 1
            } else {
                y = 1
            }
        }
        x.parent().find("input").val(y)
    });
    var k = a("#instafeed"),
        r = '<div class="instagram-item"><a href="{{link}}" target="_blank" id="{{id}}"><img src="{{image}}" /></a></div>';
    if (k.length) {
        var v = k.attr("data-userid"),
            j = k.attr("data-accesstoken"),
            u = new Instafeed({
                get: "user",
                userId: v,
                accessToken: j,
                resolution: "low_resolution",
                template: r,
                sortBy: "least-recent",
                limit: 15,
                links: false
            });
        u.run()
    }
    a(window).on("load", function () {
        a(".instagram-carousel").owlCarousel({
            loop: true,
            nav: false,
            autoplay: false,
            autoplayTimeout: 5000,
            item: 5,
            responsive: {
                0: {
                    items: 1,
                    autoplay: true,
                },
                576: {
                    items: 3
                },
                768: {
                    items: 4
                },
                1000: {
                    items: 5
                }
            }
        });
        a(".instagram-carousel-2").owlCarousel({
            loop: true,
            nav: false,
            autoplay: false,
            autoplayTimeout: 5000,
            item: 5,
            margin: 20,
            responsive: {
                0: {
                    items: 1,
                    autoplay: true,
                },
                576: {
                    items: 3
                },
                768: {
                    items: 4
                },
                1000: {
                    items: 5
                }
            }
        })
    });

    function q() {
        a(".toggle-item-active").slice(0, 4).show();
        a(".item-wrapper").find(".loadMore").on("click", function (x) {
            x.preventDefault();
            a(this).parents(".item-wrapper").find(".toggle-item-active:hidden").slice(0, 4).slideDown();
            if (a(".toggle-item-active:hidden").length == 0) {
                a(this).parent(".toggle-btn").fadeOut("slow")
            }
        })
    }
    q();
    window.sr = ScrollReveal({
        duration: 800,
        reset: false
    });
    sr.reveal(".scroll-zoom");
    a.scrollUp({
        scrollText: '<i class="sli sli-arrow-up"></i>',
        easingType: "linear",
        scrollSpeed: 900,
        animation: "fade"
    });

    function p() {
        var z = a(".mobile-aside-button"),
            y = a(".mobile-aside-close"),
            x = a(".mobile-off-canvas-active"),
            A = a(".wrapper");
        A.prepend('<div class="body-overlay"></div>');
        z.on("click", function (B) {
            B.preventDefault();
            x.addClass("inside");
            A.addClass("overlay-active")
        });
        y.on("click", function () {
            x.removeClass("inside");
            A.removeClass("overlay-active")
        });
        a(".body-overlay").on("click", function () {
            x.removeClass("inside");
            A.removeClass("overlay-active")
        })
    }
    p();
    a(".mobile-language-active").on("click", function (x) {
        x.preventDefault();
        a(".lang-dropdown-active").slideToggle(900)
    });
    a(".mobile-currency-active").on("click", function (x) {
        x.preventDefault();
        a(".curr-dropdown-active").slideToggle(900)
    });
    a(".mobile-account-active").on("click", function (x) {
        x.preventDefault();
        a(".account-dropdown-active").slideToggle(900)
    });
    var f = a(".mobile-menu"),
        g = f.find(".dropdown");
    g.parent().prepend('<span class="menu-expand"><i></i></span>');
    g.slideUp();
    f.on("click", "li a, li .menu-expand", function (y) {
        var x = a(this);
        if ((x.parent().attr("class").match(/\b(menu-item-has-children|has-children|has-sub-menu)\b/)) && (x.attr("href") === "#" || x.hasClass("menu-expand"))) {
            y.preventDefault();
            if (x.siblings("ul:visible").length) {
                x.parent("li").removeClass("active");
                x.siblings("ul").slideUp()
            } else {
                x.parent("li").addClass("active");
                x.closest("li").siblings("li").removeClass("active").find("li").removeClass("active");
                x.closest("li").siblings("li").find("ul:visible").slideUp();
                x.siblings("ul").slideDown()
            }
        }
    });
    var t = a("#slider-range");
    var l = a("#amount");
    a(function () {
        t.slider({
            range: true,
            min: 16,
            max: 400,
            values: [0, 400],
            slide: function (x, y) {
                //toto
                price_min = y.values[0]
                price_max = y.values[1]
                l.val("$" + y.values[0] + " - $" + y.values[1])
            }
        });
        l.val("$" + t.slider("values", 0) + " - $" + t.slider("values", 1))
    });
    a(".product-dec-slider").slick({
        infinite: true,
        slidesToShow: 4,
        slidesToScroll: 1,
        prevArrow: '<span class="product-dec-icon product-dec-prev"><i class="sli sli-arrow-left"></i></span>',
        nextArrow: '<span class="product-dec-icon product-dec-next"><i class="sli sli-arrow-right"></i></span>',
        responsive: [{
            breakpoint: 1199,
            settings: {
                slidesToShow: 3,
                slidesToScroll: 1
            }
        }, {
            breakpoint: 768,
            settings: {
                slidesToShow: 3,
                slidesToScroll: 1
            }
        }, {
            breakpoint: 767,
            settings: {
                slidesToShow: 4,
                slidesToScroll: 1
            }
        }, {
            breakpoint: 575,
            settings: {
                slidesToShow: 2,
                slidesToScroll: 1
            }
        }]
    });
    a(".product-dec-slider-2").slick({
        infinite: true,
        slidesToShow: 4,
        vertical: true,
        slidesToScroll: 1,
        centerPadding: "60px",
        prevArrow: '<span class="product-dec-icon product-dec-prev"><i class="sli sli-arrow-up"></i></span>',
        nextArrow: '<span class="product-dec-icon product-dec-next"><i class="sli sli-arrow-down"></i></span>',
        responsive: [{
            breakpoint: 1200,
            settings: {
                slidesToShow: 4,
                slidesToScroll: 1
            }
        }, {
            breakpoint: 1199,
            settings: {
                slidesToShow: 4,
                slidesToScroll: 1
            }
        }, {
            breakpoint: 991,
            settings: {
                slidesToShow: 4,
                slidesToScroll: 1
            }
        }, {
            breakpoint: 767,
            settings: {
                slidesToShow: 4,
                slidesToScroll: 1
            }
        }, {
            breakpoint: 575,
            settings: {
                slidesToShow: 2,
                slidesToScroll: 1
            }
        }]
    });
    a(".zoompro").elevateZoom({
        gallery: "gallery",
        galleryActiveClass: "active",
        zoomWindowWidth: 300,
        zoomWindowHeight: 100,
        scrollZoom: false,
        zoomType: "inner",
        cursor: "crosshair"
    });
    a(".video-popup").magnificPopup({
        type: "iframe",
        mainClass: "mfp-fade",
        removalDelay: 160,
        preloader: false,
        zoom: {
            enabled: true,
        }
    });
    a(".box-slider-active").owlCarousel({
        loop: true,
        nav: true,
        autoplay: false,
        autoplayTimeout: 5000,
        animateOut: "fadeOut",
        animateIn: "fadeIn",
        navText: ['<i class="sli sli-arrow-left"></i>', '<i class="sli sli-arrow-right"></i>'],
        item: 3,
        margin: 30,
        responsive: {
            0: {
                items: 1
            },
            576: {
                items: 2
            },
            768: {
                items: 3
            },
            1000: {
                items: 3
            }
        }
    });
    a(".img-popup").magnificPopup({
        type: "image",
        gallery: {
            enabled: true
        }
    });
    a(".sidebar-active").stickySidebar({
        topSpacing: 80,
        bottomSpacing: 30,
        minWidth: 767,
    });
    a(".checkout-click1").on("click", function (x) {
        x.preventDefault();
        a(".checkout-login-info").slideToggle(900)
    });
    a(".checkout-click3").on("click", function (x) {
        x.preventDefault();
        a(".checkout-login-info3").slideToggle(1000)
    });
    a(".checkout-toggle2").on("click", function () {
        a(".open-toggle2").slideToggle(1000)
    });
    a(".checkout-toggle").on("click", function () {
        a(".open-toggle").slideToggle(1000)
    });
    var n = a(".sin-payment input:checked");
    if (n) {
        a(n).siblings(".payment-box").slideDown(900)
    }
    a(".sin-payment input").on("change", function () {
        a(".payment-box").slideUp(900);
        a(this).siblings(".payment-box").slideToggle(900)
    })
})(jQuery);